//**************************************************
// Description: extract "ARP" field or "IP" field from N*128-bit data  
//**************************************************

//**************************************************
// include files
//**************************************************
`include "protocol_define.v"

module unpack #(
    parameter IN_DATA_WIDTH     = 128 ,
    parameter IN_MOD_WIDTH      = 4   
        )(
    input                           clk ,
    input                           rst_n ,
    // pre-module interface
    output                          unpack_rdy ,
    input   [IN_DATA_WIDTH-1:0]     unpack_data ,
    input   [IN_MOD_WIDTH-1:0]      unpack_mod ,
    input                           unpack_sav ,
    input                           unpack_val ,
    input                           unpack_sop ,
    input                           unpack_eop ,
    // post-module(ARP header deal) interface
    output                          ARP_enable ,
    output  [15:0]                  ARP_hard_type ,
    output  [15:0]                  ARP_prot_type ,
    output  [7:0]                   ARP_hard_len ,
    output  [7:0]                   ARP_prot_len ,
    output  [15:0]                  ARP_op ,
    output  [47:0]                  ARP_src_mac ,
    output  [31:0]                  ARP_src_ip ,
    output  [47:0]                  ARP_dst_mac ,
    output  [31:0]                  ARP_dst_ip ,
    // post-module(UDP header deal) interface
    input                           UDP_rdy ,
    output  [IN_DATA_WIDTH-1:0]     IPv4_payload , // send to "UDP deal" module
    output  [IN_MOD_WIDTH-1:0]      IPv4_mod ,
    output                          IPv4_sav ,
    output                          IPv4_val ,
    output                          IPv4_sop ,
    output                          IPv4_eop ,
    output  [31:0]                  IPv4_dst_IP ,
    output  [31:0]                  IPv4_src_IP ,
    // "data link" layer MAC field
    output  [47:0]                  DATALINK_src_mac ,
    output  [47:0]                  DATALINK_dst_mac
) ;
//**************************************************
// signal declare
//**************************************************
    reg         IP_check_val ; // CRC enable signal
    reg         IP_check_val_ff1 ;
    reg         IP_check_result ; // CRC module result
    wire        IP_check_success ;
    assign IP_check_success = 1'b1 ; // always success
    
    reg [IN_DATA_WIDTH-1:0]     unpack_data_ff1 ;
    reg [IN_MOD_WIDTH-1:0]      unpack_mod_ff1 ;
    reg                         unpack_eop_ff1 ;
    reg [IN_DATA_WIDTH-1:0]     unpack_data_ff2 ;
    reg [IN_MOD_WIDTH-1:0]      unpack_mod_ff2 ;
    reg                         unpack_eop_ff2 ;
    reg [IN_DATA_WIDTH-1:0]     unpack_data_ff3 ;
    reg [IN_MOD_WIDTH-1:0]      unpack_mod_ff3 ;
    reg                         unpack_eop_ff3 ;
    reg [IN_DATA_WIDTH-1:0]     unpack_data_ff4 ;
    reg [IN_MOD_WIDTH-1:0]      unpack_mod_ff4 ;
    reg                         unpack_eop_ff4 ;
    reg [IN_DATA_WIDTH-1:0]     unpack_data_ff5 ;
    reg [IN_MOD_WIDTH-1:0]      unpack_mod_ff5 ;
    reg                         unpack_eop_ff5 ;

    // IP check signal delay
    always @(posedge clk or negedge rst_n) begin
        if(!rst_n)
            IP_check_result <= 1'b0 ;
        else if( (!IP_check_val) && IP_check_val_ff1 )
            IP_check_result <= 1'b1 ;
        else
            IP_check_result <= 1'b0 ;
    end

    // unpack data delay
    always @(posedge clk or negedge rst_n) begin
        if(!rst_n) begin
            unpack_data_ff1 <= {(IN_DATA_WIDTH){1'b0}} ;
            unpack_mod_ff1  <= {(IN_MOD_WIDTH){1'b0}} ;
            unpack_eop_ff1  <= 1'b0 ;
            unpack_data_ff2 <= {(IN_DATA_WIDTH){1'b0}} ;
            unpack_mod_ff2  <= {(IN_MOD_WIDTH){1'b0}} ;
            unpack_eop_ff2  <= 1'b0 ;
            unpack_data_ff3 <= {(IN_DATA_WIDTH){1'b0}} ;
            unpack_mod_ff3  <= {(IN_MOD_WIDTH){1'b0}} ;
            unpack_eop_ff3  <= 1'b0 ;
            unpack_data_ff4 <= {(IN_DATA_WIDTH){1'b0}} ;
            unpack_mod_ff4  <= {(IN_MOD_WIDTH){1'b0}} ;
            unpack_eop_ff4  <= 1'b0 ;
            unpack_data_ff5 <= {(IN_DATA_WIDTH){1'b0}} ;
            unpack_mod_ff5  <= {(IN_MOD_WIDTH){1'b0}} ;
            unpack_eop_ff5  <= 1'b0 ;
        end
        else begin
            unpack_data_ff1 <= unpack_data ;
            unpack_mod_ff1  <= unpack_mod ;
            unpack_eop_ff1  <= unpack_eop ;
            unpack_data_ff2 <= unpack_data_ff1 ;
            unpack_mod_ff2  <= unpack_mod_ff1 ;
            unpack_eop_ff2  <= unpack_eop_ff1 ;
            unpack_data_ff3 <= unpack_data_ff2 ;
            unpack_mod_ff3  <= unpack_mod_ff2 ;
            unpack_eop_ff3  <= unpack_eop_ff2 ;
            unpack_data_ff4 <= unpack_data_ff3 ;
            unpack_mod_ff4  <= unpack_mod_ff3 ;
            unpack_eop_ff4  <= unpack_eop_ff3 ;
            unpack_data_ff5 <= unpack_data_ff4 ;
            unpack_mod_ff5  <= unpack_mod_ff4 ;
            unpack_eop_ff5  <= unpack_eop_ff4 ;
        end
    end
    // delay IP check valid signal (latency = 4)
    always @(posedge clk or negedge rst_n) begin
        if(!rst_n)
            IP_check_val_ff1 <= 1'b0 ;
        else
            IP_check_val_ff1 <= IP_check_val ;
    end



    // "DATALINK" data
    reg [47:0]      DATALINK_src_mac_r ;
    reg [47:0]      DATALINK_dst_mac_r ;
    // "NETWORK" counter
    reg             NETWORK_frame_count_en ; // increase the NETWORK_frame_count
    reg [6:0]       NETWORK_frame_count ; // "NETWORK_frame_count" means the IP packet that "has" been received !
    // "ARP" data
    reg             ARP_enable_r ;
    reg [15:0]      ARP_hard_type_r ;
    reg [15:0]      ARP_prot_type_r ;
    reg [7:0]       ARP_hard_len_r ;
    reg [7:0]       ARP_prot_len_r ;
    reg [15:0]      ARP_op_r ;
    reg [47:0]      ARP_src_mac_r ;
    reg [31:0]      ARP_src_ip_r ;
    reg [47:0]      ARP_dst_mac_r ;
    reg [31:0]      ARP_dst_ip_r ;
    // "IP" data
    reg [IN_DATA_WIDTH-1:0]     IPv4_payload_r ;
    reg [IN_MOD_WIDTH-1:0]      IPv4_mod_r ;
    reg                         IPv4_sav_r ;
    reg                         IPv4_val_r ;
    reg                         IPv4_sop_r ;
    reg                         IPv4_eop_r ;
    reg [31:0]                  IPv4_dst_IP_r ;
    reg [31:0]                  IPv4_src_IP_r ;
//**************************************************
// FSM
//**************************************************
    localparam UNPACK_IDLE              = 3'd0 ;
    localparam UNPACK_WAIT              = 3'd1 ;
    localparam UNPACK_ARP_HEAD          = 3'd2 ;
    localparam UNPACK_IP_HEAD           = 3'd3 ;
    localparam UNPACK_IP_ERR            = 3'd4 ;
    localparam UNPACK_IP_PAYLOAD        = 3'd5 ;
    localparam UNPACK_OTHER_PROT_HEAD   = 3'd6 ;
    localparam UNPACK_END               = 3'd7 ;
    
    reg [2:0]   unpack_state_c ;
    reg [2:0]   unpack_state_c_ff1 ;
    reg [2:0]   unpack_state_c_ff2 ;
    reg [2:0]   unpack_state_c_ff3 ;
    reg [2:0]   unpack_state_c_ff4 ;
    reg [2:0]   unpack_state_c_ff5 ;
    reg [2:0]   unpack_state_n ;

    // FSM (1)
    always @(posedge clk or negedge rst_n) begin
        if(!rst_n) begin
            unpack_state_c <= UNPACK_IDLE ;
        end
        else begin
            unpack_state_c <= unpack_state_n ;
        end
    end
    // FSM (2)
    always @(*) begin
        case(unpack_state_c)
            UNPACK_IDLE: begin
                if( (unpack_sav==1'b1) && (UDP_rdy == 1'b1) )
                    unpack_state_n = UNPACK_WAIT ;
                else
                    unpack_state_n = UNPACK_IDLE ;
            end

            UNPACK_WAIT: begin // fork down (deal the first 16-bytes)
                if( unpack_sop == 1'b1 ) begin
                    case( unpack_data[(IN_DATA_WIDTH-`DATALINK_PROT_LOC-1)-:16] )

                        `DATALINK_IPV4:     unpack_state_n = UNPACK_IP_HEAD ;
                        `DATALINK_ARP:      unpack_state_n = UNPACK_ARP_HEAD ;

                        default: unpack_state_n = UNPACK_OTHER_PROT_HEAD ;
                    endcase
                end
                else 
                    unpack_state_n = UNPACK_WAIT ;
            end

            UNPACK_ARP_HEAD: begin
                if( unpack_eop == 1'b1 )
                    unpack_state_n = UNPACK_END ;
                else
                    unpack_state_n = UNPACK_ARP_HEAD ;
            end

            UNPACK_IP_HEAD: begin
                if( IP_check_result==1'b1 )
                    if( IP_check_success==1'b1 )
                        unpack_state_n = UNPACK_IP_PAYLOAD ;
                    else
                        unpack_state_n = UNPACK_IP_ERR ;
                else
                    unpack_state_n = UNPACK_IP_HEAD ;
            end

            UNPACK_IP_PAYLOAD: begin
                if( unpack_eop_ff4 == 1'b1 )
                    unpack_state_n = UNPACK_END ;
                else
                    unpack_state_n = UNPACK_IP_PAYLOAD ;
            end

            UNPACK_IP_ERR: begin
                if( unpack_eop_ff4 == 1'b1 )
                    unpack_state_n = UNPACK_END ;
                else
                    unpack_state_n = UNPACK_IP_ERR ;
            end

            UNPACK_OTHER_PROT_HEAD: begin
                if( unpack_eop == 1'b1 )
                    unpack_state_n = UNPACK_END ;
                else
                    unpack_state_n = UNPACK_OTHER_PROT_HEAD ;
            end

            UNPACK_END: begin
                unpack_state_n = UNPACK_IDLE ;
            end
            
            default: begin
                unpack_state_n = UNPACK_IDLE ;
            end
        endcase
    end
    // FSM(3)
    // get "DATALINK" layer field(src/dst mac)
    always @(posedge clk or negedge rst_n) begin
        if(!rst_n) begin
            DATALINK_src_mac_r <= 48'b0 ;
            DATALINK_dst_mac_r <= 48'b0 ;
        end
        else if( (unpack_state_c == UNPACK_WAIT)&&(unpack_sop == 1'b1) ) begin
            DATALINK_src_mac_r <= unpack_data[(IN_DATA_WIDTH-1-48)-:48] ;
            DATALINK_dst_mac_r <= unpack_data[(IN_DATA_WIDTH-1)-:48] ;
        end
        else begin
            DATALINK_src_mac_r <= DATALINK_src_mac_r ;
            DATALINK_dst_mac_r <= DATALINK_dst_mac_r ;
        end
    end
    assign DATALINK_src_mac = DATALINK_src_mac_r ;
    assign DATALINK_dst_mac = DATALINK_dst_mac_r ;
    // set "NETWORK_frame_count_en"
    always @(posedge clk or negedge rst_n) begin
        if(!rst_n)
            NETWORK_frame_count_en <= 1'b0 ;
        else if( (unpack_state_c == UNPACK_WAIT)&&(unpack_sop == 1'b1) )
            NETWORK_frame_count_en <= 1'b1 ;
        else if(unpack_state_c == UNPACK_END)
            NETWORK_frame_count_en <= 1'b0 ;
        else
            NETWORK_frame_count_en <= NETWORK_frame_count_en ;
    end
    // increase "NETWORK_frame_count"
    always @(posedge clk or negedge rst_n) begin
        if(!rst_n)
            NETWORK_frame_count <= 7'b0 ;
        else if(NETWORK_frame_count_en==1'b1)
            NETWORK_frame_count <= NETWORK_frame_count + 1'b1 ;
        else
            NETWORK_frame_count <= 7'b0 ;
    end
    // get "IP_check_val" to get "IP_check_result"
    always @(posedge clk or negedge rst_n) begin
        if(!rst_n)
            IP_check_val <= 1'b0 ;
        else if( ((unpack_state_c == UNPACK_WAIT)&&(unpack_sop == 1'b1)) || 
                ((unpack_state_c == UNPACK_IP_HEAD) && (NETWORK_frame_count == 7'd0)) )
                // last 2-cycles(calculate 3-cycle-data)
            IP_check_val <= 1'b1 ;
        else
            IP_check_val <= 1'b0 ;
    end
    // get "unpack_rdy"
    assign unpack_rdy = ( ((unpack_state_c==UNPACK_IDLE) && UDP_rdy ==1'b1) || ((unpack_state_c==UNPACK_WAIT)&& UDP_rdy ==1'b1) )?1'b1:1'b0 ;



    //----------------------------------------------
    // UDP channel
    //----------------------------------------------
    // FSM delay
    always @(posedge clk or negedge rst_n) begin
        if(!rst_n) begin
            unpack_state_c_ff1 <= UNPACK_IDLE ;
            unpack_state_c_ff2 <= UNPACK_IDLE ;
            unpack_state_c_ff3 <= UNPACK_IDLE ;
            unpack_state_c_ff4 <= UNPACK_IDLE ;
            unpack_state_c_ff5 <= UNPACK_IDLE ;
        end
        else begin
            unpack_state_c_ff1 <= unpack_state_c ;
            unpack_state_c_ff2 <= unpack_state_c_ff1 ;
            unpack_state_c_ff3 <= unpack_state_c_ff2 ;
            unpack_state_c_ff4 <= unpack_state_c_ff3 ;
            unpack_state_c_ff5 <= unpack_state_c_ff4 ;
        end
    end

    // signal (mainly use the "ff4" state)
    always @(posedge clk or negedge rst_n) begin
        if(!rst_n) begin
            IPv4_payload_r <= {(IN_DATA_WIDTH){1'b0}} ;
            IPv4_mod_r <= {(IN_MOD_WIDTH){1'b0}} ;
            IPv4_sav_r <= 1'b0 ;
            IPv4_val_r <= 1'b0 ;
            IPv4_sop_r <= 1'b0 ;
            IPv4_eop_r <= 1'b0 ;
            IPv4_dst_IP_r <= 32'b0 ;
            IPv4_src_IP_r <= 32'b0 ;
        end
        else if( unpack_state_c == UNPACK_IP_PAYLOAD ) begin
                // The IP CRC cost 4-cycle, so use "state_ff4"
            case (NETWORK_frame_count) // start from "NETWORK_frame_count==4"
                7'd4: begin
                    // change
                    IPv4_sav_r <= 1'b1 ;
                    IPv4_src_IP_r <= unpack_data_ff4[63:16] ;

                    IPv4_dst_IP_r <= 32'b0 ;
                    IPv4_val_r <= 1'b0 ;
                    IPv4_sop_r <= 1'b0 ;
                    IPv4_eop_r <= 1'b0 ;
                    IPv4_payload_r <= {(IN_DATA_WIDTH){1'b0}} ;
                    IPv4_mod_r <= {(IN_MOD_WIDTH){1'b0}} ;
                end
                7'd5: begin
                    IPv4_sav_r <= 1'b1 ;
                    IPv4_src_IP_r <= IPv4_src_IP_r ;
                    // change
                    IPv4_dst_IP_r <= {unpack_data_ff5[15:0], unpack_data_ff4[(IN_DATA_WIDTH-1)-:16]} ;
                    
                    IPv4_val_r <= 1'b0 ;
                    IPv4_sop_r <= 1'b0 ;
                    IPv4_payload_r <= {(IN_DATA_WIDTH){1'b0}} ;
                    IPv4_mod_r <= {(IN_MOD_WIDTH){1'b0}} ;
                    IPv4_eop_r <= 1'b0 ;
                end
                7'd6: begin
                    IPv4_sav_r <= 1'b1 ;
                    IPv4_src_IP_r <= IPv4_src_IP_r ;
                    IPv4_dst_IP_r <= IPv4_dst_IP_r ;
                    // change
                    IPv4_val_r <= 1'b1 ;
                    IPv4_sop_r <= 1'b1 ;
                    IPv4_payload_r <= {unpack_data_ff5[(IN_DATA_WIDTH-1-16):0], unpack_data_ff4[(IN_DATA_WIDTH-1)-:16]} ;
                    
                    if( unpack_eop_ff4 ) begin
                            // check the next state
                        if( (unpack_mod_ff4>2) || (unpack_mod_ff4==0) ) begin
                            IPv4_eop_r <= 1'b0 ;
                            IPv4_mod_r <= {(IN_MOD_WIDTH){1'b0}} ;
                        end
                        else begin
                            IPv4_eop_r <= 1'b1 ;
                            IPv4_mod_r <= unpack_mod_ff5-(2-unpack_mod_ff4) ;
                        end
                    end
                    else begin
                        IPv4_eop_r <= 1'b0 ;
                        IPv4_mod_r <= {(IN_MOD_WIDTH){1'b0}} ;
                    end
                end
                default: begin
                    IPv4_sav_r <= 1'b1 ;
                    IPv4_src_IP_r <= IPv4_src_IP_r ;
                    IPv4_dst_IP_r <= IPv4_dst_IP_r ;
                    // change
                    IPv4_val_r <= 1'b1 ;
                    IPv4_sop_r <= 1'b0 ;
                    IPv4_payload_r <= {unpack_data_ff5[(IN_DATA_WIDTH-1-16):0], unpack_data_ff4[(IN_DATA_WIDTH-1)-:16]} ;
                    
                    if( unpack_eop_ff4 ) begin
                            // check the next state
                        if( (unpack_mod_ff4>2) || (unpack_mod_ff4==0) ) begin
                            // need another phase
                            IPv4_eop_r <= 1'b0 ;
                            IPv4_mod_r <= {(IN_MOD_WIDTH){1'b0}} ;
                        end
                        else begin
                            // this is the end of frame
                            IPv4_eop_r <= 1'b1 ;
                            IPv4_mod_r <= unpack_mod_ff5-(2-unpack_mod_ff4) ;
                        end
                    end
                    else begin
                        IPv4_eop_r <= 1'b0 ;
                        IPv4_mod_r <= {(IN_MOD_WIDTH){1'b0}} ;
                    end
                end
            endcase
        end
        else if( (unpack_state_c == UNPACK_END) && ((unpack_mod_ff5 > 2) || (unpack_mod_ff5 == 0)) ) begin
                // the IP send last time (make sure the previous state is IP send state)
            IPv4_sav_r <= 1'b0 ;
            IPv4_src_IP_r <= IPv4_src_IP_r ;
            IPv4_dst_IP_r <= IPv4_dst_IP_r ;
            
            IPv4_val_r <= 1'b1 ;
            IPv4_sop_r <= 1'b0 ;
            IPv4_payload_r <= {unpack_data_ff5[(IN_DATA_WIDTH-1-16):0], 16'b0} ;
            IPv4_mod_r <= unpack_mod_ff5-2 ;
            IPv4_eop_r <= 1'b1 ;
        end
        else begin
            IPv4_payload_r <= {(IN_DATA_WIDTH){1'b0}} ;
            IPv4_mod_r <= {(IN_MOD_WIDTH){1'b0}} ;
            IPv4_sav_r <= 1'b0 ;
            IPv4_val_r <= 1'b0 ;
            IPv4_sop_r <= 1'b0 ;
            IPv4_eop_r <= 1'b0 ;
            IPv4_dst_IP_r <= 32'b0 ;
            IPv4_src_IP_r <= 32'b0 ;
        end
    end
    
    assign IPv4_payload = IPv4_payload_r ;
    assign IPv4_mod = IPv4_mod_r ;
    assign IPv4_sav = IPv4_sav_r ;
    assign IPv4_val = IPv4_val_r ;
    assign IPv4_sop = IPv4_sop_r ;
    assign IPv4_eop = IPv4_eop_r ;
    assign IPv4_dst_IP = IPv4_dst_IP_r ;
    assign IPv4_src_IP = IPv4_src_IP_r ;


    //----------------------------------------------
    // ARP channel
    //----------------------------------------------
    always @(posedge clk or negedge rst_n) begin
        if(!rst_n) begin
            ARP_enable_r    <= 1'b0 ;
            ARP_hard_type_r <= 16'd0 ;
            ARP_prot_type_r <= 16'd0 ;
            ARP_hard_len_r  <= 8'd0  ;
            ARP_prot_len_r  <= 8'd0  ;
            ARP_op_r        <= 16'd0 ;
            ARP_src_mac_r   <= 48'd0 ;
            ARP_src_ip_r    <= 32'd0 ;
            ARP_dst_mac_r   <= 48'd0 ;
            ARP_dst_ip_r    <= 32'd0 ;
        end
        else if(unpack_state_c==UNPACK_ARP_HEAD) begin 
            if( NETWORK_frame_count == 7'b0 ) begin
                ARP_enable_r    <= 1'b0 ;
                ARP_hard_type_r <= unpack_data_ff1[15:0] ;
                ARP_prot_type_r <= unpack_data[127-:16] ;
                ARP_hard_len_r  <= unpack_data[111-:8] ;
                ARP_prot_len_r  <= unpack_data[103-:8] ;
                ARP_op_r        <= unpack_data[95-:16] ;
                ARP_src_mac_r   <= unpack_data[79-:48] ;
                ARP_src_ip_r    <= unpack_data[31:0] ;
                ARP_dst_mac_r   <= 48'd0 ;
                ARP_dst_ip_r    <= 32'd0 ;
            end
            else if( NETWORK_frame_count == 7'b1 ) begin
                ARP_enable_r    <= 1'b1 ;
                ARP_hard_type_r <= ARP_hard_type_r ;
                ARP_prot_type_r <= ARP_prot_type_r ;
                ARP_hard_len_r  <= ARP_hard_len_r ;
                ARP_prot_len_r  <= ARP_prot_len_r ;
                ARP_op_r        <= ARP_op_r ;
                ARP_src_mac_r   <= ARP_src_mac_r ;
                ARP_src_ip_r    <= ARP_src_ip_r ;
                ARP_dst_mac_r   <= unpack_data[127-:48] ;
                ARP_dst_ip_r    <= unpack_data[79-:32] ;
            end
            else begin
                ARP_enable_r    <= 1'b0 ;
                ARP_hard_type_r <= ARP_hard_type_r ;
                ARP_prot_type_r <= ARP_prot_type_r ;
                ARP_hard_len_r  <= ARP_hard_len_r ;
                ARP_prot_len_r  <= ARP_prot_len_r ;
                ARP_op_r        <= ARP_op_r ;
                ARP_src_mac_r   <= ARP_src_mac_r ;
                ARP_src_ip_r    <= ARP_src_ip_r ;
                ARP_dst_mac_r   <= ARP_dst_mac_r ;
                ARP_dst_ip_r    <= ARP_dst_ip_r ;
            end
        end
        else begin
            ARP_enable_r    <= 1'b0 ;
            ARP_hard_type_r <= 16'd0 ;
            ARP_prot_type_r <= 16'd0 ;
            ARP_hard_len_r  <= 8'd0  ;
            ARP_prot_len_r  <= 8'd0  ;
            ARP_op_r        <= 16'd0 ;
            ARP_src_mac_r   <= 48'd0 ;
            ARP_src_ip_r    <= 32'd0 ;
            ARP_dst_mac_r   <= 48'd0 ;
            ARP_dst_ip_r    <= 32'd0 ;
        end
    end
    assign ARP_enable       = ARP_enable_r    ;
    assign ARP_hard_type    = ARP_hard_type_r ;
    assign ARP_prot_type    = ARP_prot_type_r ;
    assign ARP_hard_len     = ARP_hard_len_r  ;
    assign ARP_prot_len     = ARP_prot_len_r  ;
    assign ARP_op           = ARP_op_r        ;
    assign ARP_src_mac      = ARP_src_mac_r   ;
    assign ARP_src_ip       = ARP_src_ip_r    ;
    assign ARP_dst_mac      = ARP_dst_mac_r   ;
    assign ARP_dst_ip       = ARP_dst_ip_r    ;

endmodule



